<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

	<!-- http://localhost:8088/ws-ch06-cxf-spring/add.jsp -->
	<!-- http://localhost:8088/ws-ch06-cxf-spring-client/ajax.jsp -->
	<h4>使用ajax测试webservice</h4>

	<input type="button" id="scott" value="查询所有的学生" /> 

</body>
	<script type="text/javascript" src="js/jquery-1.4.1.js"></script>
	
	<script type="text/javascript">
		$(function(){
			
			//get请求在IE浏览器中会访问缓存 解决方法 在请求后面加上毫秒级的请求 骗过浏览器 让浏览器以为是不同的请求 而post请求不会
			$('#scott').click(function(){
				
				$.get('CxfServlet',null,function(data){
					
					$(data).each(function(index,student){
						
						var id = student.id;
						var name = student.name;
						var age = student.age;
						console.log('id='+id+",name="+name+",age="+age);
					});
					
				},'json');
				
			});
		});
	
	</script>
</html>